﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <!-- The styles -->
    <link href="Theme/Css/leftmenu.css" rel="stylesheet" />
    <script src="Scripts/jquery-2.0.3.min.js" type="text/javascript"></script>
    <script src="Scripts/ShareData.js" type="text/javascript"></script>
    <script type="text/javascript">
        var flag = share.data("Flag");
        var menuId = share.data("SelectedMenuId");
        $(document).ready(function () {
            var menuData;
            var type;
            if (menuId == 2 || menuId == 6 || menuId == 7) {
                menuData = '[{"Name":"公司简介","URL":"About/About.html"},{"Name":"企业愿景","URL":""},{"Name":"发展目标","URL":""},{"Name":"企业荣誉","URL":""},{"Name":"业务范围","URL":""},{"Name":"客户留言","URL":"Contact.html"},{"Name":"联系我们","URL":"PhoneUS.html"}]';
                generateFixedMenu(eval(menuData));
            }
            else {
                if (menuId == 1) {
                    type = 1;
                }
                else if (menuId == 3) {
                    type = 3;
                }
                else if (menuId == 4) {
                    type = 2;
                }
                else if (menuId == 5) {
                    type = 4;
                }
                getArticles(type);
            }
            //
        })
        function getArticles(category) {
            $.ajax({
                //方法所在页面和方法名   
                url: "BlueHomeHandler.ashx?method=Getcategorytype&Type=" + category,
                contentType: "application/json",
                dataType: "json",
                success: function (data) {
                    //返回的数据用data.d获取内容                  
                    //total_q=data.d;
                    generateMenu(data.ResponseData);
                    return true;
                },
                error: function (err) {
                    alert(err);
                    return false;
                }
            });
        }
        //动态左侧菜单加载
        function generateMenu(data) {
            $(".nav").empty();
            for (var i = 0 ; i < data.length; i++) {
                //内层循环追加li                          
                //$(".nav").append("<li><a onclick='toURL(" + data[i].ID + ")' target='rightContent'>" + data[i].TypeName + "<a/></li>");
                $(".nav").append("<li>" +
                    "<a class='ajax-link' onclick='toURL(" + data[i].ID + ")' target='rightContent'>" +
                    "<i class='icon-edit'></i>" +
                    "<span class='hidden-tablet'>" + data[i].TypeName +
                    "</span></a></li>");
            }
            share.data("SelectedSubMenuId", -1);
            if (flag == 1) {
                self.parent.frames["rightContent"].location.href = "ShowPage.html";
            }
            else {
                self.parent.frames["rightContent"].location.href = "RightMenu.html";
            }
        }
        //固定左侧菜单加载
        function generateFixedMenu(data) {
            $(".nav").empty();
            for (var i = 0 ; i < data.length; i++) {
                //内层循环追加li          
                //$(".nav").append('<li class="on"><a href="' + data[i].URL + '" target="rightContent">' + data[i].Name + '</a></li>');
                $(".nav").append("<li>" +
                    "<a class='ajax-link' href='" + data[i].URL + "' target='rightContent'>" +
                    "<i class='icon-edit'></i>" +
                    "<span class='hidden-tablet'>" + data[i].Name +
                    "</span></a></li>");
            }
            if (menuId == 2) {
                $(".nav li a")[0].click();
            }
            if (menuId == 6) {
                $(".nav li a")[5].click();
            }
            if (menuId == 7) {
                $(".nav li a")[6].click();
            }
        }
        function toURL(cId) {
            share.data("SelectedSubMenuId", cId);
            self.parent.frames["rightContent"].location.href = "RightMenu.html";
        }
    </script>
</head>
<body>
    <div class="navbox">
        <ul class="nav">
        </ul>
    </div>
</body>
</html>
